home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / Editions.p < prev    next >
Encoding:
Text File  |  1995-07-06  |  13.3 KB  |  428 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Editions.p
  3.  
  4.      Contains:    Edition Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT Editions;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __EDITIONS__}
  30. {$SETC __EDITIONS__ := 1}
  31.  
  32. {$I+}
  33. {$SETC EditionsIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __MEMORY__}
  38. {$I Memory.p}
  39. {$ENDC}
  40. {    Types.p                                                        }
  41. {        ConditionalMacros.p                                        }
  42. {    MixedMode.p                                                    }
  43.  
  44. {$IFC UNDEFINED __TYPES__}
  45. {$I Types.p}
  46. {$ENDC}
  47.  
  48. {$IFC UNDEFINED __FILES__}
  49. {$I Files.p}
  50. {$ENDC}
  51. {    OSUtils.p                                                    }
  52. {    Finder.p                                                    }
  53.  
  54. {$IFC UNDEFINED __ALIASES__}
  55. {$I Aliases.p}
  56. {$ENDC}
  57. {    AppleTalk.p                                                    }
  58.  
  59. {$IFC UNDEFINED __DIALOGS__}
  60. {$I Dialogs.p}
  61. {$ENDC}
  62. {    Errors.p                                                    }
  63. {    Menus.p                                                        }
  64. {        Quickdraw.p                                                }
  65. {            QuickdrawText.p                                        }
  66. {    Controls.p                                                    }
  67. {    Windows.p                                                    }
  68. {        Events.p                                                }
  69. {    TextEdit.p                                                    }
  70.  
  71. {$PUSH}
  72. {$ALIGN MAC68K}
  73. {$LibExport+}
  74.  
  75. CONST
  76. { resource types  }
  77.     rSectionType                = 'sect';                        { ResType of saved SectionRecords }
  78. { Finder types for edition files }
  79.     kPICTEditionFileType        = 'edtp';
  80.     kTEXTEditionFileType        = 'edtt';
  81.     ksndEditionFileType            = 'edts';
  82.     kUnknownEditionFileType        = 'edtu';
  83.     kPublisherDocAliasFormat    = 'alis';
  84.     kPreviewFormat                = 'prvw';
  85.     kFormatListFormat            = 'fmts';
  86.  
  87. { section types }
  88.     stSubscriber                = $01;
  89.     stPublisher                    = $0A;
  90.     sumAutomatic                = 0;                            { subscriber update mode - Automatically     }
  91.     sumManual                    = 1;                            { subscriber update mode - Manually }
  92.     pumOnSave                    = 0;                            { publisher update mode - OnSave            }
  93.     pumManual                    = 1;                            { publisher update mode - Manually }
  94.     kPartsNotUsed                = 0;
  95.     kPartNumberUnknown            = -1;                            { misc }
  96.     kPreviewWidth                = 120;
  97.     kPreviewHeight                = 120;
  98. { bits for formatsMask }
  99.     kPICTformatMask                = 1;
  100.     kTEXTformatMask                = 2;
  101.     ksndFormatMask                = 4;
  102. { pseudo-item hits for dialogHooks 
  103.  the first if for NewPublisher or NewSubscriber Dialogs }
  104.     emHookRedrawPreview            = 150;
  105. { the following are for SectionOptions Dialog }
  106.     emHookCancelSection            = 160;
  107.     emHookGoToPublisher            = 161;
  108.     emHookGetEditionNow            = 162;
  109.     emHookSendEditionNow        = 162;
  110.     emHookManualUpdateMode        = 163;
  111.     emHookAutoUpdateMode        = 164;
  112.  
  113. { the refcon field of the dialog record during a modalfilter 
  114.  or dialoghook contains one the following }
  115.     emOptionsDialogRefCon        = 'optn';
  116.     emCancelSectionDialogRefCon    = 'cncl';
  117.     emGoToPubErrDialogRefCon    = 'gerr';
  118.     kFormatLengthUnknown        = -1;
  119.  
  120. { one byte, stSubscriber or stPublisher }
  121.     
  122. TYPE
  123.     SectionType = SignedByte;
  124.  
  125. { seconds since 1904 }
  126.     TimeStamp = LONGINT;
  127.  
  128. { similar to ResType }
  129.     FormatType = FourCharCode;
  130.  
  131. { used in Edition I/O }
  132.     EditionRefNum = Handle;
  133.  
  134. { update modes }
  135. { sumAutomatic, pumSuspend, etc }
  136.     UpdateMode = INTEGER;
  137.  
  138.     SectionPtr = ^SectionRecord;
  139.     SectionHandle = ^SectionPtr;
  140.  
  141.     SectionRecord = RECORD
  142.         version:                SignedByte;                                { always 0x01 in system 7.0 }
  143.         kind:                    SectionType;                            { stSubscriber or stPublisher }
  144.         mode:                    UpdateMode;                                { auto or manual }
  145.         mdDate:                    TimeStamp;                                { last change in document }
  146.         sectionID:                LONGINT;                                { app. specific, unique per document }
  147.         refCon:                    LONGINT;                                { application specific }
  148.         alias:                    AliasHandle;                            { handle to Alias Record }
  149.         subPart:                LONGINT;                                { which part of container file }
  150.         nextSection:            SectionHandle;                            { for linked list of app's Sections }
  151.         controlBlock:            Handle;                                    { used internally }
  152.         refNum:                    EditionRefNum;                            { used internally }
  153.     END;
  154.  
  155.     EditionContainerSpec = RECORD
  156.         theFile:                FSSpec;
  157.         theFileScript:            ScriptCode;
  158.         thePart:                LONGINT;
  159.         thePartName:            Str31;
  160.         thePartScript:            ScriptCode;
  161.     END;
  162.  
  163.     EditionContainerSpecPtr = ^EditionContainerSpec;
  164.  
  165.     EditionInfoRecord = RECORD
  166.         crDate:                    TimeStamp;                                { date EditionContainer was created }
  167.         mdDate:                    TimeStamp;                                { date of last change }
  168.         fdCreator:                OSType;                                    { file creator }
  169.         fdType:                    OSType;                                    { file type }
  170.         container:                EditionContainerSpec;                    { the Edition }
  171.     END;
  172.  
  173.     NewPublisherReply = RECORD
  174.         canceled:                BOOLEAN;                                { O }
  175.         replacing:                BOOLEAN;
  176.         usePart:                BOOLEAN;                                { I }
  177.         filler:                    SInt8;
  178.         preview:                Handle;                                    { I }
  179.         previewFormat:            FormatType;                                { I }
  180.         container:                EditionContainerSpec;                    { I/O }
  181.     END;
  182.  
  183.     NewSubscriberReply = RECORD
  184.         canceled:                BOOLEAN;                                { O }
  185.         formatsMask:            SignedByte;
  186.         container:                EditionContainerSpec;                    {I/O}
  187.     END;
  188.  
  189.     SectionOptionsReply = RECORD
  190.         canceled:                BOOLEAN;                                { O }
  191.         changed:                BOOLEAN;                                { O }
  192.         sectionH:                SectionHandle;                            { I }
  193.         action:                    ResType;                                { O }
  194.     END;
  195.  
  196.     ExpModalFilterProcPtr = ProcPtr;  { FUNCTION ExpModalFilter(theDialog: DialogPtr; VAR theEvent: EventRecord; itemOffset: INTEGER; VAR itemHit: INTEGER; yourDataPtr: Ptr): BOOLEAN; }
  197.     ExpDlgHookProcPtr = ProcPtr;  { FUNCTION ExpDlgHook(itemOffset: INTEGER; itemHit: INTEGER; theDialog: DialogPtr; yourDataPtr: Ptr): INTEGER; }
  198.     ExpModalFilterUPP = UniversalProcPtr;
  199.     ExpDlgHookUPP = UniversalProcPtr;
  200.  
  201. CONST
  202.     uppExpModalFilterProcInfo = $0000FBD0; { FUNCTION (4 byte param, 4 byte param, 2 byte param, 4 byte param, 4 byte param): 1 byte result; }
  203.     uppExpDlgHookProcInfo = $00003EA0; { FUNCTION (2 byte param, 2 byte param, 4 byte param, 4 byte param): 2 byte result; }
  204.  
  205. FUNCTION NewExpModalFilterProc(userRoutine: ExpModalFilterProcPtr): ExpModalFilterUPP;
  206.     {$IFC NOT GENERATINGCFM }
  207.     INLINE $2E9F;
  208.     {$ENDC}
  209.  
  210. FUNCTION NewExpDlgHookProc(userRoutine: ExpDlgHookProcPtr): ExpDlgHookUPP;
  211.     {$IFC NOT GENERATINGCFM }
  212.     INLINE $2E9F;
  213.     {$ENDC}
  214.  
  215. FUNCTION CallExpModalFilterProc(theDialog: DialogPtr; VAR theEvent: EventRecord; itemOffset: INTEGER; VAR itemHit: INTEGER; yourDataPtr: Ptr; userRoutine: ExpModalFilterUPP): BOOLEAN;
  216.     {$IFC NOT GENERATINGCFM}
  217.     INLINE $205F, $4E90;
  218.     {$ENDC}
  219.  
  220. FUNCTION CallExpDlgHookProc(itemOffset: INTEGER; itemHit: INTEGER; theDialog: DialogPtr; yourDataPtr: Ptr; userRoutine: ExpDlgHookUPP): INTEGER;
  221.     {$IFC NOT GENERATINGCFM}
  222.     INLINE $205F, $4E90;
  223.     {$ENDC}
  224.  
  225. CONST
  226.     ioHasFormat                    = 0;
  227.     ioReadFormat                = 1;
  228.     ioNewFormat                    = 2;
  229.     ioWriteFormat                = 3;
  230.  
  231.     
  232. TYPE
  233.     FormatIOVerb = SignedByte;
  234.  
  235.  
  236. CONST
  237.     eoOpen                        = 0;
  238.     eoClose                        = 1;
  239.     eoOpenNew                    = 2;
  240.     eoCloseNew                    = 3;
  241.     eoCanSubscribe                = 4;
  242.  
  243.     
  244. TYPE
  245.     EditionOpenerVerb = SignedByte;
  246.  
  247.     FormatIOParamBlock = RECORD
  248.         ioRefNum:                LONGINT;
  249.         format:                    FormatType;
  250.         formatIndex:            LONGINT;
  251.         offset:                    LONGINT;
  252.         buffPtr:                Ptr;
  253.         buffLen:                LONGINT;
  254.     END;
  255.  
  256.     FormatIOProcPtr = ProcPtr;  { FUNCTION FormatIO(selector: ByteParameter; VAR PB: FormatIOParamBlock): INTEGER; }
  257.     EditionOpenerProcPtr = ProcPtr;  { FUNCTION EditionOpener(selector: ByteParameter; VAR PB: EditionOpenerParamBlock): INTEGER; }
  258.     FormatIOUPP = UniversalProcPtr;
  259.     EditionOpenerUPP = UniversalProcPtr;
  260.  
  261.     EditionOpenerParamBlock = RECORD
  262.         info:                    EditionInfoRecord;
  263.         sectionH:                SectionHandle;
  264.         document:                ^FSSpec;
  265.         fdCreator:                OSType;
  266.         ioRefNum:                LONGINT;
  267.         ioProc:                    FormatIOUPP;
  268.         success:                BOOLEAN;
  269.         formatsMask:            SignedByte;
  270.     END;
  271.  
  272. CONST
  273.     uppFormatIOProcInfo = $00000360; { FUNCTION (1 byte param, 4 byte param): 2 byte result; }
  274.     uppEditionOpenerProcInfo = $00000360; { FUNCTION (1 byte param, 4 byte param): 2 byte result; }
  275.  
  276. FUNCTION NewFormatIOProc(userRoutine: FormatIOProcPtr): FormatIOUPP;
  277.     {$IFC NOT GENERATINGCFM }
  278.     INLINE $2E9F;
  279.     {$ENDC}
  280.  
  281. FUNCTION NewEditionOpenerProc(userRoutine: EditionOpenerProcPtr): EditionOpenerUPP;
  282.     {$IFC NOT GENERATINGCFM }
  283.     INLINE $2E9F;
  284.     {$ENDC}
  285.  
  286. CONST
  287.     sectionEventMsgClass        = 'sect';
  288.     sectionReadMsgID            = 'read';
  289.     sectionWriteMsgID            = 'writ';
  290.     sectionScrollMsgID            = 'scrl';
  291.     sectionCancelMsgID            = 'cncl';
  292.  
  293.     currentEditionMgrVers        = $0011;
  294.  
  295. { Use InitEditionPackVersion(currentEditionMgrVers) instead of InitEditionPack }
  296.  
  297. FUNCTION InitEditionPackVersion(curEditionMgrVers: INTEGER): OSErr;
  298.     {$IFC NOT GENERATINGCFM}
  299.     INLINE $303C, $0100, $A82D;
  300.     {$ENDC}
  301. FUNCTION NewSection({CONST}VAR container: EditionContainerSpec; sectionDocument: ConstFSSpecPtr; kind: ByteParameter; sectionID: LONGINT; initalMode: UpdateMode; VAR sectionH: SectionHandle): OSErr;
  302.     {$IFC NOT GENERATINGCFM}
  303.     INLINE $303C, $0A02, $A82D;
  304.     {$ENDC}
  305. FUNCTION RegisterSection({CONST}VAR sectionDocument: FSSpec; sectionH: SectionHandle; VAR aliasWasUpdated: BOOLEAN): OSErr;
  306.     {$IFC NOT GENERATINGCFM}
  307.     INLINE $303C, $0604, $A82D;
  308.     {$ENDC}
  309. FUNCTION UnRegisterSection(sectionH: SectionHandle): OSErr;
  310.     {$IFC NOT GENERATINGCFM}
  311.     INLINE $303C, $0206, $A82D;
  312.     {$ENDC}
  313. FUNCTION IsRegisteredSection(sectionH: SectionHandle): OSErr;
  314.     {$IFC NOT GENERATINGCFM}
  315.     INLINE $303C, $0208, $A82D;
  316.     {$ENDC}
  317. FUNCTION AssociateSection(sectionH: SectionHandle; {CONST}VAR newSectionDocument: FSSpec): OSErr;
  318.     {$IFC NOT GENERATINGCFM}
  319.     INLINE $303C, $040C, $A82D;
  320.     {$ENDC}
  321. FUNCTION CreateEditionContainerFile({CONST}VAR editionFile: FSSpec; fdCreator: OSType; editionFileNameScript: ScriptCode): OSErr;
  322.     {$IFC NOT GENERATINGCFM}
  323.     INLINE $303C, $050E, $A82D;
  324.     {$ENDC}
  325. FUNCTION DeleteEditionContainerFile({CONST}VAR editionFile: FSSpec): OSErr;
  326.     {$IFC NOT GENERATINGCFM}
  327.     INLINE $303C, $0210, $A82D;
  328.     {$ENDC}
  329. FUNCTION OpenEdition(subscriberSectionH: SectionHandle; VAR refNum: EditionRefNum): OSErr;
  330.     {$IFC NOT GENERATINGCFM}
  331.     INLINE $303C, $0412, $A82D;
  332.     {$ENDC}
  333. FUNCTION OpenNewEdition(publisherSectionH: SectionHandle; fdCreator: OSType; publisherSectionDocument: ConstFSSpecPtr; VAR refNum: EditionRefNum): OSErr;
  334.     {$IFC NOT GENERATINGCFM}
  335.     INLINE $303C, $0814, $A82D;
  336.     {$ENDC}
  337. FUNCTION CloseEdition(whichEdition: EditionRefNum; successful: BOOLEAN): OSErr;
  338.     {$IFC NOT GENERATINGCFM}
  339.     INLINE $303C, $0316, $A82D;
  340.     {$ENDC}
  341. FUNCTION EditionHasFormat(whichEdition: EditionRefNum; whichFormat: FormatType; VAR formatSize: Size): OSErr;
  342.     {$IFC NOT GENERATINGCFM}
  343.     INLINE $303C, $0618, $A82D;
  344.     {$ENDC}
  345. FUNCTION ReadEdition(whichEdition: EditionRefNum; whichFormat: FormatType; buffPtr: UNIV Ptr; VAR buffLen: Size): OSErr;
  346.     {$IFC NOT GENERATINGCFM}
  347.     INLINE $303C, $081A, $A82D;
  348.     {$ENDC}
  349. FUNCTION WriteEdition(whichEdition: EditionRefNum; whichFormat: FormatType; buffPtr: UNIV Ptr; buffLen: Size): OSErr;
  350.     {$IFC NOT GENERATINGCFM}
  351.     INLINE $303C, $081C, $A82D;
  352.     {$ENDC}
  353. FUNCTION GetEditionFormatMark(whichEdition: EditionRefNum; whichFormat: FormatType; VAR currentMark: LONGINT): OSErr;
  354.     {$IFC NOT GENERATINGCFM}
  355.     INLINE $303C, $061E, $A82D;
  356.     {$ENDC}
  357. FUNCTION SetEditionFormatMark(whichEdition: EditionRefNum; whichFormat: FormatType; setMarkTo: LONGINT): OSErr;
  358.     {$IFC NOT GENERATINGCFM}
  359.     INLINE $303C, $0620, $A82D;
  360.     {$ENDC}
  361. FUNCTION GetEditionInfo(sectionH: SectionHandle; VAR editionInfo: EditionInfoRecord): OSErr;
  362.     {$IFC NOT GENERATINGCFM}
  363.     INLINE $303C, $0422, $A82D;
  364.     {$ENDC}
  365. FUNCTION GoToPublisherSection({CONST}VAR container: EditionContainerSpec): OSErr;
  366.     {$IFC NOT GENERATINGCFM}
  367.     INLINE $303C, $0224, $A82D;
  368.     {$ENDC}
  369. FUNCTION GetLastEditionContainerUsed(VAR container: EditionContainerSpec): OSErr;
  370.     {$IFC NOT GENERATINGCFM}
  371.     INLINE $303C, $0226, $A82D;
  372.     {$ENDC}
  373. FUNCTION GetStandardFormats({CONST}VAR container: EditionContainerSpec; VAR previewFormat: FormatType; preview: Handle; publisherAlias: Handle; formats: Handle): OSErr;
  374.     {$IFC NOT GENERATINGCFM}
  375.     INLINE $303C, $0A28, $A82D;
  376.     {$ENDC}
  377. FUNCTION GetEditionOpenerProc(VAR opener: EditionOpenerUPP): OSErr;
  378.     {$IFC NOT GENERATINGCFM}
  379.     INLINE $303C, $022A, $A82D;
  380.     {$ENDC}
  381. FUNCTION SetEditionOpenerProc(opener: EditionOpenerUPP): OSErr;
  382.     {$IFC NOT GENERATINGCFM}
  383.     INLINE $303C, $022C, $A82D;
  384.     {$ENDC}
  385. FUNCTION CallEditionOpenerProc(selector: ByteParameter; VAR PB: EditionOpenerParamBlock; routine: EditionOpenerUPP): OSErr;
  386.     {$IFC NOT GENERATINGCFM}
  387.     INLINE $303C, $052E, $A82D;
  388.     {$ENDC}
  389. FUNCTION CallFormatIOProc(selector: ByteParameter; VAR PB: FormatIOParamBlock; routine: FormatIOUPP): OSErr;
  390.     {$IFC NOT GENERATINGCFM}
  391.     INLINE $303C, $0530, $A82D;
  392.     {$ENDC}
  393. FUNCTION NewSubscriberDialog(VAR reply: NewSubscriberReply): OSErr;
  394.     {$IFC NOT GENERATINGCFM}
  395.     INLINE $303C, $0232, $A82D;
  396.     {$ENDC}
  397. FUNCTION NewSubscriberExpDialog(VAR reply: NewSubscriberReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookUPP; filter: ExpModalFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  398.     {$IFC NOT GENERATINGCFM}
  399.     INLINE $303C, $0B34, $A82D;
  400.     {$ENDC}
  401. FUNCTION NewPublisherDialog(VAR reply: NewPublisherReply): OSErr;
  402.     {$IFC NOT GENERATINGCFM}
  403.     INLINE $303C, $0236, $A82D;
  404.     {$ENDC}
  405. FUNCTION NewPublisherExpDialog(VAR reply: NewPublisherReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookUPP; filter: ExpModalFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  406.     {$IFC NOT GENERATINGCFM}
  407.     INLINE $303C, $0B38, $A82D;
  408.     {$ENDC}
  409. FUNCTION SectionOptionsDialog(VAR reply: SectionOptionsReply): OSErr;
  410.     {$IFC NOT GENERATINGCFM}
  411.     INLINE $303C, $023A, $A82D;
  412.     {$ENDC}
  413. FUNCTION SectionOptionsExpDialog(VAR reply: SectionOptionsReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookUPP; filter: ExpModalFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  414.     {$IFC NOT GENERATINGCFM}
  415.     INLINE $303C, $0B3C, $A82D;
  416.     {$ENDC}
  417.  
  418. {$ALIGN RESET}
  419. {$POP}
  420.  
  421. {$SETC UsingIncludes := EditionsIncludes}
  422.  
  423. {$ENDC} {__EDITIONS__}
  424.  
  425. {$IFC NOT UsingIncludes}
  426.  END.
  427. {$ENDC}
  428.